Page({
  data: {
    camreaImg: '',
    frame: {}
  },
  onLoad(options) {
    this.setData({
      previewInfo: JSON.parse(options.preview_info)
    });
  },

  takePhoto() {
    const ctx = wx.createCameraContext()
    ctx.takePhoto({
      quality: 'high',
      success: (res) => {
        this.setData({
          camreaImg: res.tempImagePath
        })
      }
    })
  },

  error(e) {
    console.log(e.detail)
  },

  move(e) {
    let td = this.data, client_info = e.touches[0];
    console.log(client_info.clientX);
    td.frame.top = client_info.clientY - 105;
    td.frame.left = client_info.clientX - 105;
    this.setData({
      frame: td.frame
    })
  }
});